from django.contrib import admin
from .models import HomeFirstCategoryModel,HomeSecondCategoryModel,HomeThirdCategoryModel
# Register your models here.


class SecondCategoryTable(admin.TabularInline):
    model = HomeSecondCategoryModel
    fields = ['id','name']


class HomeFirstCategoryAdmin(admin.ModelAdmin):
    inlines = [SecondCategoryTable]
    list_display = ['id','name']
    list_filter = ['name','home_second_category_home_first_category__name']
    ordering = ['id']


class HomeThirdCategoryTable(admin.TabularInline):
    model = HomeThirdCategoryModel
    fields = ['id', 'name']


class HomeSecondCategoryAdmin(admin.ModelAdmin):
    inlines = [HomeThirdCategoryTable]
    list_display = ['id','name']
    list_filter = ['name','home_third_category_home_second_category__name',
                   'home_first_category__name']
    ordering = ['id']


class HomeThirdCategoryAdmin(admin.ModelAdmin):
    list_display = ['id','name']
    list_filter = ['name','home_second_category__name']
    ordering = ['id']




admin.site.register(HomeFirstCategoryModel,HomeFirstCategoryAdmin)
admin.site.register(HomeSecondCategoryModel,HomeSecondCategoryAdmin)
admin.site.register(HomeThirdCategoryModel,HomeThirdCategoryAdmin)







